# 返回杨慧三角的第k行
def yanghuiTriangle(rowIndex):
    if rowIndex < 2:
        if rowIndex == 0:
            return [1]
        else:
            return [1, 1]
    prev = yanghuiTriangle(rowIndex - 1)
    row = []
    for j in range(rowIndex + 1):
        if j == 0 or j == rowIndex:
            row.append(1)
        else:
            row.append(prev[j] + prev[j - 1])
    return row


print(yanghuiTriangle(0))  # [1]
print(yanghuiTriangle(1))  # [[1]]
print(yanghuiTriangle(2))  # [[1], [1, 1]]
print(yanghuiTriangle(3))  # [[1], [1, 1], [1, 2, 1]]
print(yanghuiTriangle(5))  # [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]
